import ready from "../../script/base.js";
import createTd3 from "../../script/module/td3.js";
import createPlayer from "../../script/module/music.163.player.js";
import createRadio from "../../script/module/radio.js";
import Board from "../../script/module/board.js";

ready(
  () => {
    console.log("interactive");
    const radio = createRadio();
    radio.onclick = () => {
      const td3 = createTd3(); // 创建第三列
      const player = createPlayer(7631930848, true); // 创建网易云音乐播放器
      td3.appendChild(player); // 添加网易云播放器到第三列中
      const animation = radio.querySelector('.radio-svg').animate([
        { transform: 'rotate(0) scale(1)', opacity: 1 },
        { transform: 'rotate(360deg) scale(0)', opacity: 0 }
      ], {
        duration: 1000,
        iterations: 1,
      })
      animation.addEventListener('finish', () => {
        radio.remove();
      })
    }
    document
      .body
      .appendChild(radio);
  },
  () => {
    console.log("complete");
    const board = new Board(); // 创建留言板包装类
    board
      .setBoardWelcomeText("hi，欢迎留言！LZQ QQ：1468743505")
      .installBoardFilter(() => {
        alert("少说脏话");
      });
  }
);
